package com.weishuang.monitor.leader.commons.tree;

import com.baomidou.mybatisplus.annotation.TableField;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: TODO
 * @Author weishuang
 * @Date 2018/7/415:32
 */
public class TreeVO<T> {
    /**
     * 标题
     */
    @TableField(exist = false)
    private String title;
    /**
     * 是否展开直子节点
     */
    @TableField(exist = false)
    private Boolean expand = false;
    /**
     * 禁掉响应
     */
    @TableField(exist = false)
    private Boolean disabled = false;
    /**
     * 禁掉 checkbox
     */
    @TableField(exist = false)
    private Boolean disableCheckbox = false;
    /**
     * 是否选中子节点
     */
    @TableField(exist = false)
    private Boolean selected = false;
    /**
     * 是否勾选(如果勾选，子节点也会全部勾选)
     */
    @TableField(exist = false)
    private Boolean checked = false;
    /**
     * 子数组
     */
    @TableField(exist = false)
    private List<T> children = new ArrayList<>();

    /**
     * 异步加载
     */
    @TableField(exist = false)
    private Boolean loading;

    public Boolean getLoading() {
        return loading;
    }

    public void setLoading(Boolean loading) {
        this.loading = loading;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Boolean getExpand() {
        return expand;
    }

    public void setExpand(Boolean expand) {
        this.expand = expand;
    }

    public Boolean getDisabled() {
        return disabled;
    }

    public void setDisabled(Boolean disabled) {
        this.disabled = disabled;
    }

    public Boolean getDisableCheckbox() {
        return disableCheckbox;
    }

    public void setDisableCheckbox(Boolean disableCheckbox) {
        this.disableCheckbox = disableCheckbox;
    }

    public Boolean getSelected() {
        return selected;
    }

    /**
     * 为了TreeUtils进行设置选中
     * @return
     */
    public Boolean checked() {
        this.checked = true;
        return this.checked;
    }

    public void setSelected(Boolean selected) {
        this.selected = selected;
    }

    public Boolean getChecked() {
        return checked;
    }

    public void setChecked(Boolean checked) {
        this.checked = checked;
    }

    public List<T> getChildren() {
        return children;
    }

    public void setChildren(List<T> children) {
        this.children = children;
    }
}
